package arithmetic;

/**
 * 回形矩阵
 * 例如：
 * 1  2  3 
 * 8  9  4
 * 7  6  5
 * 
 * @author: yyfei  
 * @email:  yyfei123@qq.com
 */
public class HuiXingJuZheng {
	public static void main(String[] args) {
		int len=3;
		//计数器
		int count=0;
		//下标
		int start=0;
		int end=len;
		//矩阵
		int[][] jz=new int[len][len];
		
		while (count<len*len) {
			//第一行赋值
			for (int i = start; i < end; i++) {
				jz[start][i]=++count;
			}
			//右侧赋值
			for (int i = start; i < jz.length; i++) {
				
			}
			
			//底部赋值
			for (int i = 0; i < jz.length; i++) {
				
			}
			
			//左侧赋值
			for (int i = 0; i < jz.length; i++) {
				
			}
			//位置改变
			start++;
			end--;
		}
		
		//打印矩阵
		for (int i = 0; i < jz.length; i++) {
			for (int j = 0; j < jz.length; j++) {
				System.out.print(jz[i][j]+"   ");
			}
			System.out.println("\n");
		}
		
	}
}
